package com.greensam.pixelengine.pojo.vo.role.response;

import cn.hutool.core.bean.BeanUtil;
import com.greensam.pixelengine.pojo.base.BaseDto;
import com.greensam.pixelengine.pojo.entity.PermissionPo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;

import java.util.Objects;

/**
 * @author Ma Chengrui
 * @since 2025/9/30 14:41
 */
@Getter
@Setter
@Schema(title = "权限信息")
public class PermissionVo extends BaseDto {

    @Schema(title = "权限ID")
    private Long id;

    @Schema(title = "权限名称")
    private String name;

    @Schema(title = "权限标识")
    private String code;

    @Schema(title = "权限描述")
    private String description;

    /**
     * 空间实体类转封装类
     *
     * @param po 空间实体类
     * @author Ma Chengrui
     * @since 2025/6/30
     */
    public static PermissionVo permissionVo2Po(PermissionPo po) {
        if (Objects.isNull(po)) {
            return null;
        }
        return BeanUtil.copyProperties(po, PermissionVo.class);
    }
}
